package com.example.pattern.observer.demo02;

public class MouseEventTest {

    public static void main(String[] args) {
        MouseEventCallback callback = new MouseEventCallback();

        //注册事件
        Mouse mouse = new Mouse();
        mouse.addListener(MouseEventType.ON_CLICK, callback);
        mouse.addListener(MouseEventType.ON_MOVE, callback);
        mouse.addListener(MouseEventType.ON_WHEEL, callback);
        mouse.addListener(MouseEventType.ON_OVER, callback);
        mouse.addListener(MouseEventType.ON_BLUR, callback);

        //调用方法
        mouse.click();
        //失焦事件
        mouse.blur();
        //弹起事件
        mouse.up();
    }

}
